<template>
  <div class="amor">
    <div class="amor_1"  v-for="(item,index) in list" :key="index">
      <img
        :src="item.url"
        :alt="item.title"
      />

      <div class="amor_2">
        <span class="span4">{{item.title}}</span>
        <div class="solo">
          <span class="span5">{{item.price}}</span>
          <span class="span6">已售{{item.inventory}}件</span>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      list: []
    };
  },
  methods: {
    async classifydata(text) {
      let { data } = await this.$axios.get(
        `http://localhost:3000/list?text=${text}`
      );
      this.list = data;
      window.console.log(this.list);
    }
  },
  created() {
    this.classifydata("send_friend");
  }
};
</script>
<style scoped lang="scss">
@function vw($px) {
  @return ($px / 375) * 100vw;
}
.amor_1 {
  background: #ffffff;
  margin-left: vw(6);
  margin-bottom: vw(6);
  width: vw(179);
  height: vw(232);
  // border: 1px solid red;
  img {
    width: vw(179);
    height: vw(179);
  }
  .amor_2 {
    padding-left: vw(10);
    height: vw(53);
    display: flex;
    flex-direction: column;
    justify-content: space-around;

    .span4 {
      font-size: vw(13);
    }
    .solo {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .span5 {
        font-size: vw(16);
        font-weight: bold;
        color: red;
      }
      .span6 {
        font-size: 13px;
        color: gray;
      }
    }
  }
}
</style>
